/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.cemaden.smp.controler;

import br.gov.cemaden.library.model.smp.ClassesAplic;
import java.io.Serializable;
import java.lang.management.ClassLoadingMXBean;

/**
 *
 * @author Simone Santos
 */
public class ClassesAplicBean implements Serializable {

    ClassesAplic classes = new ClassesAplic();

    public ClassesAplicBean() {
    }

    public ClassesAplic get(ClassLoadingMXBean remoteClass) {

        double loaded = (double) (remoteClass.getLoadedClassCount());
        double unLoaded = (double) (remoteClass.getUnloadedClassCount());
        double clTotal = (double) (remoteClass.getTotalLoadedClassCount());

        classes.setTotal(clTotal);
        classes.setLoaded(loaded);
        classes.setUnLoaded(unLoaded);
        return classes;
    }

    public void show(ClassesAplic t) {

        String separator = "--------------------------------";

        System.out.printf("Classes%nLoaded: %f%nUnLoaded: %f%nTotal: %f%n%s%n", t.getLoaded(), t.getUnLoaded(), t.getTotal(), separator);
    }
}